<?php

$query_time = date("Y-m-d",time());
$qishu_query = "";
if($_GET['s_time']){
    $query_time = $_GET['s_time'];
	if(!regExp::checkTime($query_time))exit;
}
if($_GET['qishu_query']){
    $qishu_query = $_GET['qishu_query'];
	if(!regExp::isNumber($qishu_query,1,50))exit;
}
$lottery_type = $_GET['gtype'];
if($lottery_type=="3d"){
    $gType = "d3";
}elseif($lottery_type=="pl3"){
    $gType = "p3";
}elseif($lottery_type=="T3"){
    $gType = "t3";
}
?>
<link rel="stylesheet" href="/resource/images/css/admin_style_1.css" type="text/css" media="all" />
<script language="javascript" src="/resource/js/jquery-1.7.2.min.js"></script>
<script language="javascript">
    function queryLottery(){
//        var timeParam = $("#s_time").val();
//        if(!timeParam){
//            alert("请选择日期。");
//            return false;
//        }
        return true;
    }
</script>
<div id="search_content">
<div class="round-table">
    <form name="Frm_search_drawno"  id="Frm_search_drawno" method="get" onSubmit="return queryLottery();" action="./">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="font12" style="margin-top:5px;" >
            <tr style="background-color:#FFFFFF;">
                <td align="left">
                    <?php include "sl.php";?>
                    &nbsp;&nbsp;开奖期号：
                    <input name="qishu_query" type="text" id="qishu_query" value="<?=$qishu_query?>" size="20" maxlength="11"/>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input name="submit" type="submit" class="submit80" value="搜索"/>
                </td>
            </tr>
        </table>
    </form>
</div>
</div>
<div class="round-table">
    <table width="100%" border="0" cellpadding="5" cellspacing="1" class="font12" style="margin-top:2px;" bgcolor="#798EB9">
        <tr  class="title_tr" style="background-color:#2161b3; color:#FFF">
            <td align="center" width="16%"><strong>彩票类别</strong></td>
            <td align="center" width="16%"><strong>彩票期号</strong></td>
            <td align="center" width="20%"><strong>开奖时间</strong></td>
            <td align="center" width="16%"><strong>百位</strong></td>
            <td align="center" width="16%"><strong>十位</strong></td>
            <td align="center" width="16%"><strong>个位</strong></td>
        </tr>
        <?php

        $sql = "SELECT id,qishu,create_time,datetime,state,prev_text,
    ball_1,ball_2,ball_3
    FROM lottery_result_".$gType." ";
        if($qishu_query){
            $sql .= " AND qishu = '$qishu_query'";
        }
        $sql .= " ORDER BY qishu DESC limit 0,20";
        $query	=	$mysqli->query($sql);
        $hasRow = "false";
		if($query)
        while($rows = $query->fetch_array()){
            $hasRow = "true";
            $color = "#FFFFFF";
            $over	 = "#EBEBEB";
            $out	 = "#ffffff";
            $hm 		= array();
            $hm[]		= BuLing($rows['ball_1']);
            $hm[]		= BuLing($rows['ball_2']);
            $hm[]		= BuLing($rows['ball_3']);
            ?>
            <tr   class="R_tr" align="center" onMouseOver="this.style.backgroundColor='<?=$over?>'" onMouseOut="this.style.backgroundColor='<?=$out?>'" style="background-color:<?=$color?>; line-height:20px;">
                <td height="25" align="center" valign="middle"><?=getZhPageTitle($lottery_type)?></td>
                <td align="center" valign="middle"><?=$rows['qishu']?></td>
                <td align="center" valign="middle"><?=$rows['datetime']?></td>
                <td align="center" valign="middle"><img src="/images/Lottery/Images/ball_2/<?=$rows['ball_1']?>.png"></td>
                <td align="center" valign="middle"><img src="/images/Lottery/Images/ball_2/<?=$rows['ball_2']?>.png"></td>
                <td align="center" valign="middle"><img src="/images/Lottery/Images/ball_2/<?=$rows['ball_3']?>.png"></td>
            </tr>
        <?php
        }
        if($hasRow=="false"){
            ?>
            <tr   class="R_tr" align="center" >
                <td height="25" colspan="10" align="center" valign="middle">暂时没有开奖结果</td>
            </tr>
        <?php
        }
        ?>
    </table>
</div>